<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
class Course_provider_model extends AppModel{
    var $_tablename = CUSTOMERS;
    var $_primary_key = CUSTOMERS_CUSTOMER_ID;
	var $url_prefix = '/Nha-Cung-Cap/';
    function Course_provider_model($id=NULL){
        parent::AppModel($id);
        $CI = &get_instance();
    }
    
    function get_blocks($mem_id){
        $cond = array(CUSTOMERS_CUSTOMER_ID=>$this->mem_id);
        $this->db->where($cond);
        return $this->db->get(CUSTOMERS)->result();
    }
	
	function hasCUSTOMERS($itemId)
	{
		$q = $this->db->get_where(CUSTOMERS, array( CUSTOMERS_CUSTOMER_ID=>$itemId));
		return $q->num_rows()>0;
	}
	function do_login($email, $password){
        $this->db->where('login_email', $email);
        $query = $this->db->get($this->_tablename);
        if($query->num_rows() == 0)
            return 0;
        $row = $query->row_array();
        if($row['passw'] != md5($password))
            return -1;
        return $row;
    }
}
?>